require('dotenv').config();

const connectDB = require('./db/connectDB');
const Job = require('./models/Job');
const jobsJson = require('./db/jobs.json');

console.log(process.env.MONGO_URI)
const start = async () => {
   try {
      await connectDB(process.env.MONGO_URI);
      await Job.deleteMany();
      await Job.create(jobsJson);
      console.log('Data imported');
      process.exit(0);
   } catch (error) {
      console.log(error);
      process.exit(1);
   }
};

start()